package com.example.cpms.mapper;

import com.example.cpms.entity.Propety;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.DeleteMapping;

import java.util.List;

@Mapper
public interface PropetyMapper {

    /**
     * 物业费分页查询
     * @param username
     * @param buildingname
     * @return
     */
    List<Propety> list(String username, String buildingname);


    /**
     * 删除物业费账单
     * @param id
     */
    @Delete("delete from propety where id = #{id}")
    void delete(Integer id);

    /**
     * 新增物业费账单
     * @param propety
     */
    @Insert("insert into propety(username,buildingname,propertyFeePrice,startTime,endTime) values(#{username},#{buildingname},#{propertyFeePrice},#{startTime},#{endTime})")
    void insert(Propety propety);


    /**
     * 编辑物业费账单
     * @param propety
     */
    @Update("update propety set username = #{username}, buildingname = #{buildingname}," +
            " propertyFeePrice = #{propertyFeePrice}, propertyFeePrice = #{propertyFeePrice} where id = #{id} ")
    void update(Propety propety);
}
